package com.huawei.appgallery.forum.posts.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.Formatter;
import java.util.Locale;
import o.bzd.b;
import o.bzd.h;

public class CountDownLayout extends LinearLayout {
    private static long ʻ = HwAccountConstants.CHECK_SITE_COUNTRY_DURATION;
    private static long ʽ = 8553600000L;
    private static long ˋॱ = 1000;
    private static long ͺ = 60000;
    private static long ᐝ = 3600000;
    private long ʻॱ;
    public TextView ʼ;
    public TextView ˊ;
    private View ˊॱ;
    public TextView ˋ;
    public TextView ˎ;
    public TextView ˏ;
    private long ˏॱ;
    public TextView ॱ;
    private long ॱˊ;
    private long ॱˋ;
    private StringBuilder ॱˎ;
    public TextView ॱॱ;
    private Formatter ॱᐝ;

    public CountDownLayout(Context context) {
        this(context, null);
    }

    public CountDownLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public CountDownLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ˊ();
        this.ॱˎ = new StringBuilder();
        this.ॱᐝ = new Formatter(this.ॱˎ, Locale.getDefault());
    }

    public void ˊ() {
        this.ˊॱ = LayoutInflater.from(getContext()).inflate(h.ᐝॱ, this);
        this.ˎ = (TextView) this.ˊॱ.findViewById(b.ՙ);
        this.ॱ = (TextView) this.ˊॱ.findViewById(b.ॱʾ);
        this.ˏ = (TextView) this.ˊॱ.findViewById(b.ॱʿ);
        this.ˋ = (TextView) this.ˊॱ.findViewById(b.ॱˉ);
        this.ˊ = (TextView) this.ˊॱ.findViewById(b.ॱˈ);
        this.ʼ = (TextView) this.ˊॱ.findViewById(b.ߺ);
        this.ॱॱ = (TextView) this.ˊॱ.findViewById(b.ߵ);
    }

    public void setPromoteTime(long j) {
        if (j > ʽ || j < 0) {
            setVisibility(4);
            return;
        }
        setVisibility(0);
        this.ॱˊ = j / ʻ;
        if (this.ॱˊ == 0) {
            this.ˎ.setVisibility(8);
            this.ˊ.setVisibility(8);
        } else {
            this.ˎ.setVisibility(0);
            this.ˊ.setVisibility(0);
            this.ˎ.setText(ˎ(this.ॱˊ));
        }
        long j2 = j % ʻ;
        this.ˏॱ = j2 / ᐝ;
        this.ॱ.setText(ˎ(this.ˏॱ));
        j2 %= ᐝ;
        this.ॱˋ = j2 / ͺ;
        this.ˏ.setText(ˎ(this.ॱˋ));
        this.ʻॱ = (j2 % ͺ) / ˋॱ;
        this.ˋ.setText(ˎ(this.ʻॱ));
    }

    public String ˎ(long j) {
        this.ॱˎ.setLength(0);
        return this.ॱᐝ.format("%02d", new Object[]{Long.valueOf(j)}).toString();
    }

    public void setVisibility(int i) {
        super.setVisibility(i);
        if (getChildCount() > 0 && getChildAt(0) != null) {
            if (i == 4) {
                getChildAt(0).setVisibility(8);
            } else {
                getChildAt(0).setVisibility(i);
            }
        }
    }
}
